@layout("/common/_container.html",{js:["/assets/modular/system/project/project_things.js"]}){
<style>
    .input {
        border: none;
    }

    .editinput {
        width: 200px;
    }

    .name {
        font-weight: bold;
        color: #0C0C0C;
    }

    .layui-table tbody tr:hover,
    .layui-table thead tr,
    .layui-table-click,
    .layui-table-header,
    .layui-table-hover,
    .layui-table-mend,
    .layui-table-patch, .layui-table-tool,
    .layui-table-total, .layui-table-total tr, .layui-table[lay-even] tr:nth-child(even) {
        background-color: #FFFFFF;
    }

    td {
        white-space: nowrap;
    }
</style>
</head>
<body id="tables">
<div class="layui-col-lg4" style="margin-bottom: 30px">
    <table class="layui-table">

        <thead>
        <tr>
            <td>菜品分类</td>
            <td>名称</td>
            <td>单价/元</td>
            <td>分数</td>
            <td>单位</td>
        </tr>
        </thead>
        <tbody>
        <tr>
            <td><input class="input" value="凉菜" id="dishes" style="width: 100px;"/></td>
            <td><input class="input" value="青花椒烤鱼" id="fish" style="width: 100px;"/></td>
            <td><input class="input" value="10" id="price" style="width: 50px;"/></td>
            <td><input class="input" value="10" id="score" style="width: 50px;"/></td>
            <td><input class="input" value="条" id="unit" style="width: 50px;"/></td>
        </tr>
        <tr>
            <td><input class="input" value="凉菜" id="dishes1" style="width: 100px;"/></td>
            <td><input class="input" value="青花椒烤鱼" id="fish1" style="width: 100px;"/></td>
            <td><input class="input" value="10" id="price1" style="width: 50px;"/></td>
            <td><input class="input" value="10" id="score1" style="width: 50px;"/></td>
            <td><input class="input" value="条" id="unit1" style="width: 50px;"/></td>
        </tr>
        <tr>
            <td><input class="input" value="凉菜" id="dishes2" style="width: 100px;"/></td>
            <td><input class="input" value="青花椒烤鱼" id="fish2" style="width: 100px;"/></td>
            <td><input class="input" value="10" id="price2" style="width: 50px;"/></td>
            <td><input class="input" value="10" id="score2" style="width: 50px;"/></td>
            <td><input class="input" value="条" id="unit2" style="width: 50px;"/></td>
        </tr>
        <tr>
            <td><input class="input" value="凉菜" id="dishes3" style="width: 100px;"/></td>
            <td><input class="input" value="青花椒烤鱼" id="fish3" style="width: 100px;"/></td>
            <td><input class="input" value="10" id="price3" style="width: 50px;"/></td>
            <td><input class="input" value="10" id="score3" style="width: 50px;"/></td>
            <td><input class="input" value="条" id="unit3" style="width: 50px;"/></td>
        </tr>
        <tr>
            <td><input class="input" value="凉菜" id="dishes4" style="width: 100px;"/></td>
            <td><input class="input" value="青花椒烤鱼" id="fish4" style="width: 100px;"/></td>
            <td><input class="input" value="10" id="price4" style="width: 50px;"/></td>
            <td><input class="input" value="10" id="score4" style="width: 50px;"/></td>
            <td><input class="input" value="条" id="unit4" style="width: 50px;"/></td>
        </tr>
        <tr>
            <td><input class="input" value="凉菜" id="dishes5" style="width: 100px;"/></td>
            <td><input class="input" value="青花椒烤鱼" id="fish5" style="width: 100px;"/></td>
            <td><input class="input" value="10" id="price5" style="width: 50px;"/></td>
            <td><input class="input" value="10" id="score5" style="width: 50px;"/></td>
            <td><input class="input" value="条" id="unit5" style="width: 50px;"/></td>
        </tr>
        <tr>
            <td><input class="input" value="凉菜" id="dishes6" style="width: 100px;"/></td>
            <td><input class="input" value="青花椒烤鱼" id="fish6" style="width: 100px;"/></td>
            <td><input class="input" value="10" id="price6" style="width: 50px;"/></td>
            <td><input class="input" value="10" id="score6" style="width: 50px;"/></td>
            <td><input class="input" value="条" id="unit6" style="width: 50px;"/></td>
        </tr>
        <tr>
            <td><input class="input" value="凉菜" id="dishes7" style="width: 100px;"/></td>
            <td><input class="input" value="青花椒烤鱼" id="fish7" style="width: 100px;"/></td>
            <td><input class="input" value="10" id="price7" style="width: 50px;"/></td>
            <td><input class="input" value="10" id="score7" style="width: 50px;"/></td>
            <td><input class="input" value="条" id="unit7" style="width: 50px;"/></td>
        </tr>
        <tr>
            <td><input class="input" value="凉菜" id="dishes8" style="width: 100px;"/></td>
            <td><input class="input" value="青花椒烤鱼" id="fish8" style="width: 100px;"/></td>
            <td><input class="input" value="10" id="price8" style="width: 50px;"/></td>
            <td><input class="input" value="10" id="score8" style="width: 50px;"/></td>
            <td><input class="input" value="条" id="unit8" style="width: 50px;"/></td>
        </tr>
        <tr>
            <td><input class="input" value="凉菜" id="dishes9" style="width: 100px;"/></td>
            <td><input class="input" value="青花椒烤鱼" id="fish9" style="width: 100px;"/></td>
            <td><input class="input" value="10" id="price9" style="width: 50px;"/></td>
            <td><input class="input" value="10" id="score9" style="width: 50px;"/></td>
            <td><input class="input" value="条" id="unit9" style="width: 50px;"/></td>
        </tr>

        <tr>
            <td style="border: none"></td>
            <td></td>
            <td><input class="input" value="10" id="price10" style="width: 50px;"/></td>
            <td><input class="input" value="10" id="score10" style="width: 50px;"/></td>
            <td><input class="input" value="条" id="unit10" style="width: 50px;"/></td>
        </tr>
        <tr>
            <td style="border: none"></td>
            <td></td>
            <td><input class="input" value="10" id="price11" style="width: 50px;"/></td>
            <td><input class="input" value="10" id="score11" style="width: 50px;"/></td>
            <td><input class="input" value="条" id="unit11" style="width: 50px;"/></td>
        </tr>
        <tr>
            <td style="border: none"></td>
            <td>套餐原价</td>
            <td><input class="input" style="width: 50px;" id="tctj"/></td>
            <td><input class="input" style="width: 50px;" id="tctj1"/></td>
            <td><input class="input" style="width: 50px;" id="tctj2"/></td>
        </tr>
        </tbody>
    </table>
</div>
</div>
<div class="layui-col-lg5" style="margin-bottom: 30px">
    <table class="layui-table">

        <thead>
        <tr>
            <td colspan="2" style="text-align: center">套餐信息</td>
        </tr>
        </thead>
        <tbody>
        <tr>
            <td><input class="input editinput" id="packageName" value="套餐名称:2-3人清江鱼套餐" lay-verify="required" required/>
            </td>
            <td>建议用餐人数:2-3人</td>
        </tr>
        <tr>
            <td colspan="2">购买须知</td>
        </tr>
        </thead>
        <tr>
            <td><input class="input editinput" id="capita" value="店内参考人均:60" lay-verify="required" required/></td>
            <td><input class="input editinput" id="securities" value="美团劵有效期:12个月" lay-verify="required" required/></td>
        </tr>
        <tr>
            <td><input class="input editinput" id="unusable" value="不可用日期（备注具体日期）" lay-verify="required" required/></td>
            <td>使用时间:10:00 ~ 21:30</td>
        </tr>
        <tr>
            <td><input class="input editinput" id="terms " value="限制性条款/特殊情况:" lay-verify="required" required/></td>
            <td>是否可以预约:是</td>
        </tr>
        <tr>
            <td><input class="input editinput" id="fee" value="茶位费/餐巾纸/服务费是否已含:详情咨询商家" lay-verify="required" required/>
            </td>
            <td>是否可以使用包间:否</td>
        </tr>
        <tr>
            <td colspan="2"><input class="input editinput" id="review" value="点评/美团:不限量/限量x份;每日限量x份（如需设置,必须提供双测量）"
                                   lay-verify="required" required/></td>
        </tr>
        <tr>
            <td colspan="2">发布信息</td>
        </tr>
        <tr>
            <td colspan="2"><input class="input editinput" id="bulk" value="美团价(团购价):" lay-verify="required" required/>
            </td>
        </tr>
        <tr>
            <td colspan="2">图片要求</td>
        </tr>
        <tr>
            <td colspan="2">1.首图大小:640*388,首图数量:1-5张,格式:jpg,jpeg,png,bmp,gif,不可上传超长连图</td>
        </tr>
        <tr>
            <td colspan="2">2.详情图大小:宽度702像素,高度适当即可,不要细长型,10张以内;大小不超过5m</td>
        </tr>
        <tr>
            <td colspan="2">菜品分类</td>
        </tr>
        <tr>
            <td colspan="2">1.请使用规范的菜品分类名称,如:冷菜、前菜、饮品、小吃、荤菜等,避免出现有歧义的分类名称</td>
        </tr>
        <tr>
            <td colspan="2">2.同一菜品分类的也请独立罗列,切勿合并单元格</td>
        </tr>
        </tbody>
    </table>
</div>
<div class="layui-col-lg3" style="margin-bottom: 30px">
    <table class="layui-table">
        <tbody>
        <thead>
        <tr>
            <td colspan="2" style="text-align: center">具体门店</td>
        </tr>
        <tr>
            <td>门店名称</td>
            <td>门店美团链接</td>
        </tr>
        <tr>
            <td><input class="input" value="22" id="mtmc"/></td>
            <td><input class="input" value="22" id="mtlj"/></td>
        </tr>
        <tr>
            <td><input class="input" value="22" id="mtmc1"/></td>
            <td><input class="input" value="22" id="mtlj1"/></td>
        </tr>
        <tr>
            <td><input class="input" value="22" id="mtmc2"/></td>
            <td><input class="input" value="22" id="mtlj2"/></td>
        </tr>
        </tbody>
    </table>
</div>
<div class="layui-inline layui-col-lg12" style="margin-top: 20px;text-align: center">
    <a id="dlink"  style="display:none;"></a>
    <button class="layui-btn icon-btn" onclick="tableToExcel('tables','name', '线上套餐.xls')"><i class="layui-icon">&#xe67d;</i>下载
    </button>
    <button id="btnKeep" class="layui-btn icon-btn"><i class="layui-icon">&#xe67d;</i>保存
    </button>
    <button id="backupPage" class="layui-btn icon-btn">返回
    </button>
</div>
</body>

<script src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="application/javascript">
    const id = '${id}';
    const lists = [${list}];
    var list = [];

    $(function () {
        for (let i = 0; i < lists[0][0].length; i++) {
            let pinCode = lists[0][0][i].pinCode;
            $("#" + pinCode + "").val(lists[0][0][i].data);
            $("#" + pinCode + "").attr("readonly", true);
        }
    });

    $('#btnKeep').click(function () {
        for (let i = 1; i < 73; i++) {
            var object = {};
            if (i == 1) {
                object.proId = id;
                object.mouldId = "35";
                object.data = $('#dishes').val();
                object.pinCode = 'dishes';
            } else if (i == 2) {
                object.data = $('#dishes1').val();
                object.pinCode = 'dishes1';
            } else if (i == 3) {
                object.data = $('#dishes2').val();
                object.pinCode = 'dishes2';
            } else if (i == 4) {
                object.data = $('#dishes3').val();
                object.pinCode = 'dishes3';
            } else if (i == 5) {
                object.data = $('#dishes4').val();
                object.pinCode = 'dishes4';
            } else if (i == 6) {
                object.data = $('#dishes5').val();
                object.pinCode = 'dishes5';
            } else if (i == 7) {
                object.data = $('#dishes6').val();
                object.pinCode = 'dishes6';
            } else if (i == 8) {
                object.data = $('#dishes7').val();
                object.pinCode = 'dishes7';
            } else if (i == 9) {
                object.data = $('#dishes8').val();
                object.pinCode = 'dishes8';
            } else if (i == 10) {
                object.data = $('#dishes9').val();
                object.pinCode = 'dishes9';
            } else if (i == 11) {
                object.data = $('#fish').val();
                object.pinCode = 'fish';
            } else if (i == 12) {
                object.data = $('#fish1').val();
                object.pinCode = 'fish1';
            } else if (i == 13) {
                object.data = $('#fish2').val();
                object.pinCode = 'fish2';
            } else if (i == 14) {
                object.data = $('#fish3').val();
                object.pinCode = 'fish3';
            } else if (i == 15) {
                object.data = $('#fish4').val();
                object.pinCode = 'fish4';
            } else if (i == 16) {
                object.data = $('#fish5').val();
                object.pinCode = 'fish5';
            } else if (i == 17) {
                object.data = $('#fish6').val();
                object.pinCode = 'fish6';
            } else if (i == 18) {
                object.data = $('#fish7').val();
                object.pinCode = 'fish7';
            } else if (i == 19) {
                object.data = $('#fish8').val();
                object.pinCode = 'fish8';
            } else if (i == 20) {
                object.data = $('#fish9').val();
                object.pinCode = 'fish9';
            } else if (i == 21) {
                object.data = $('#price').val();
                object.pinCode = "price";
            } else if (i == 22) {
                object.data = $('#price1').val();
                object.pinCode = "price1";
            } else if (i == 23) {
                object.data = $('#price2').val();
                object.pinCode = "price2";
            } else if (i == 24) {
                object.data = $('#price3').val();
                object.pinCode = "price3";
            } else if (i == 25) {
                object.data = $('#price4').val();
                object.pinCode = "price4";
            } else if (i == 26) {
                object.data = $('#price5').val();
                object.pinCode = "price5";
            } else if (i == 27) {
                object.data = $('#price6').val();
                object.pinCode = "price6";
            } else if (i == 28) {
                object.data = $('#price7').val();
                object.pinCode = "price7";
            } else if (i == 29) {
                object.data = $('#price8').val();
                object.pinCode = "price8";
            } else if (i == 30) {
                object.data = $('#price9').val();
                object.pinCode = "price9";
            } else if (i == 31) {
                object.data = $('#price10').val();
                object.pinCode = "price10";
            } else if (i == 32) {
                object.data = $('#price11').val();
                object.pinCode = "price11";
            } else if (i == 33) {
                object.data = $('#score').val();
                object.pinCode = "score";
            } else if (i == 34) {
                object.data = $('#score1').val();
                object.pinCode = "score1";
            } else if (i == 35) {
                object.data = $('#score2').val();
                object.pinCode = "score2";
            } else if (i == 36) {
                object.data = $('#score3').val();
                object.pinCode = "score3";
            } else if (i == 37) {
                object.data = $('#score4').val();
                object.pinCode = "score4";
            } else if (i == 38) {
                object.data = $('#score5').val();
                object.pinCode = "score5";
            } else if (i == 39) {
                object.data = $('#score6').val();
                object.pinCode = "score6";
            } else if (i == 40) {
                object.data = $('#score7').val();
                object.pinCode = "score7";
            } else if (i == 41) {
                object.data = $('#score8').val();
                object.pinCode = "score8";
            } else if (i == 42) {
                object.data = $('#score9').val();
                object.pinCode = "score9";
            } else if (i == 43) {
                object.data = $('#score10').val();
                object.pinCode = "score10";
            } else if (i == 44) {
                object.data = $('#score11').val();
                object.pinCode = "score11";
            } else if (i == 45) {
                object.data = $('#unit').val();
                object.pinCode = "unit";
            } else if (i == 46) {
                object.data = $('#unit1').val();
                object.pinCode = "unit1";
            } else if (i == 47) {
                object.data = $('#unit2').val();
                object.pinCode = "unit2";
            } else if (i == 48) {
                object.data = $('#unit3').val();
                object.pinCode = "unit3";
            } else if (i == 49) {
                object.data = $('#unit4').val();
                object.pinCode = "unit4";
            } else if (i == 49) {
                object.data = $('#unit5').val();
                object.pinCode = "unit5";
            } else if (i == 51) {
                object.data = $('#unit6').val();
                object.pinCode = "unit6";
            } else if (i == 52) {
                object.data = $('#unit7').val();
                object.pinCode = "unit7";
            } else if (i == 53) {
                object.data = $('#unit8').val();
                object.pinCode = "unit8";
            } else if (i == 54) {
                object.data = $('#unit9').val();
                object.pinCode = "unit9";
            } else if (i == 55) {
                object.data = $('#unit10').val();
                object.pinCode = "unit10";
            } else if (i == 56) {
                object.data = $('#unit11').val();
                object.pinCode = "unit11";
            } else if (i == 57) {
                object.data = $('#tctj').val();
                object.pinCode = "tctj";
            } else if (i == 58) {
                object.data = $('#tctj1').val();
                object.pinCode = "tctj1";
            } else if (i == 59) {
                object.data = $('#tctj2').val();
                object.pinCode = "tctj2";
            } else if (i == 60) {
                object.data = $('#packageName').val();
                object.pinCode = "packageName";
            } else if (i == 61) {
                object.data = $('#capita').val();
                object.pinCode = "capita";
            } else if (i == 62) {
                object.data = $('#securities').val();
                object.pinCode = "securities";
            } else if (i == 63) {
                object.data = $('#unusable').val();
                object.pinCode = "unusable";
            } else if (i == 64) {
                object.data = $('#terms').val();
                object.pinCode = "terms";
            } else if (i == 65) {
                object.data = $('#fee').val();
                object.pinCode = "fee";
            } else if (i == 66) {
                object.data = $('#review').val();
                object.pinCode = "review";
            } else if (i == 67) {
                object.data = $('#bulk').val();
                object.pinCode = "bulk";
            } else if (i == 68) {
                object.data = $('#mtmc').val();
                object.pinCode = "mtmc";
            } else if (i == 69) {
                object.data = $('#mtlj').val();
                object.pinCode = "mtlj";
            } else if (i == 70) {
                object.data = $('#mtmc1').val();
                object.pinCode = "mtmc1";
            } else if (i == 71) {
                object.data = $('#mtlj1').val();
                object.pinCode = "mtlj1";
            } else if (i == 72) {
                object.data = $('#mylj2').val();
                object.pinCode = "mylj2";
            } else if (i == 73) {
                object.data = $('#mylj2').val();
                object.pinCode = "mylj2";
            }
            object.sort = i;
            list.push(object)
        }
        $.ajax({
            type: "post",
            url: "/mouldBoardMsg/add",
            data: JSON.stringify(list),
            contentType: 'application/json',
            async: false,
            success: function (data) {
                list = [];
            }
        });
    });
    /**
     * 导出excel按钮
     */
    var tableToExcel = (function () {
        var uri = 'data:application/vnd.ms-excel;base64,',
            template = '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"><head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--></head><body><table>{table}</table></body></html>',
            base64 = function (s) { return window.btoa(unescape(encodeURIComponent(s))) },
            format = function (s, c) { return s.replace(/{(\w+)}/g, function (m, p) { return c[p]; }) };
        return function (table, name, filename) {
            if (!table.nodeType) table = document.getElementById(table)
            var ctx = { worksheet: name || 'Worksheet', table: table.innerHTML }
            document.getElementById("dlink").href = uri + base64(format(template, ctx));
            document.getElementById("dlink").download = filename;
            document.getElementById("dlink").click();
        }
    })()

</script>

@}